## Process this file with automake to produce Makefile.in

AUTOMAKE_OPTIONS = foreign

# This is so we can #include <package/foo>
AM_CPPFLAGS = -I$(srcdir) $(PROTOBUF_CFLAGS) $(GLOG_CFLAGS)

# These are good warnings to turn on by default
if GCC
AM_CXXFLAGS = -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
endif

## The -no-undefined flag allows libtool to generate shared libraries for
## Cygwin and MinGW.
AM_LDFLAGS = $(PROTOBUF_LIBS) $(GLOG_LIBS) -no-undefined

## The libraries (.so's) you want to install
lib_LTLIBRARIES =

protobuf_expectation_includedir = $(includedir)/google/protobuf-expectation
## The .h files you want to install (that is, .h files that people
## who install this package can include in their own applications.)
protobuf_expectation_include_HEADERS = \
	google/protobuf-expectation/expectation-eval.h \
	google/protobuf-expectation/proto-kit-converter.h

protobuf_expectation_protodir = $(includedir)/google/protobuf-expectation
dist_protobuf_expectation_proto_DATA = \
	google/protobuf-expectation/expectation.proto \
	google/protobuf-expectation/proto-kit.proto

## unittests you want to run when people type 'make check'.
## TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
## TESTS_ENVIRONMENT sets environment variables for when you run unittest,
## but it only seems to take effect for *binary* unittests (argh!)
TESTS =
TESTS_ENVIRONMENT =
check_SCRIPTS =
# Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS =


## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS

# Rules to compile existing proto files.

protoc_inputs = \
	google/protobuf-expectation/expectation.proto \
	google/protobuf-expectation/proto-kit.proto \
	google/protobuf-expectation/proto-kit-generator_test.proto \
	google/protobuf-expectation/unittest.proto \
	google/protobuf-expectation/unittest-kit.proto

EXTRA_DIST = \
	google/protobuf-expectation/proto-kit-generator_test.proto \
	google/protobuf-expectation/unittest.proto \
	google/protobuf-expectation/unittest-kit.proto

protoc_outputs = \
	google/protobuf-expectation/expectation.pb.cc \
	google/protobuf-expectation/expectation.pb.h \
	google/protobuf-expectation/proto-kit.pb.cc \
	google/protobuf-expectation/proto-kit.pb.h \
	google/protobuf-expectation/proto-kit-generator_test.pb.cc \
	google/protobuf-expectation/proto-kit-generator_test.pb.h \
	google/protobuf-expectation/unittest.pb.cc \
	google/protobuf-expectation/unittest.pb.h \
	google/protobuf-expectation/unittest-kit.pb.cc \
	google/protobuf-expectation/unittest-kit.pb.h

BUILT_SOURCES = $(protoc_outputs)

protoc_middleman: $(protoc_inputs)
	$(PROTOC) --proto_path=$(srcdir) --cpp_out=$(srcdir) $(protoc_inputs)
	touch protoc_middleman

$(protoc_outputs): protoc_middleman

# Rules to build the protobuf expectation library.

lib_LTLIBRARIES += libprotobuf-expectation.la

libprotobuf_expectation_la_SOURCES = \
	google/protobuf-expectation/expectation-eval.cc \
	google/protobuf-expectation/proto-kit-converter.cc \
	google/protobuf-expectation/stubs/ascii_ctype.cc \
	google/protobuf-expectation/stubs/ascii_ctype.h \
	google/protobuf-expectation/stubs/case.h \
	google/protobuf-expectation/stubs/casts.h \
	google/protobuf-expectation/stubs/integral_types.h \
	google/protobuf-expectation/stubs/macros.h \
	google/protobuf-expectation/stubs/mathlimits.cc \
	google/protobuf-expectation/stubs/mathlimits.h \
	google/protobuf-expectation/stubs/mathutil.h \
	google/protobuf-expectation/stubs/numbers.cc \
	google/protobuf-expectation/stubs/numbers.h \
	google/protobuf-expectation/stubs/port.h \
	google/protobuf-expectation/stubs/port_hash.h \
	google/protobuf-expectation/stubs/scoped_ptr.h \
	google/protobuf-expectation/stubs/stl_decl.h \
	google/protobuf-expectation/stubs/stringprintf.cc \
	google/protobuf-expectation/stubs/stringprintf.h \
	google/protobuf-expectation/stubs/strtoint.cc \
	google/protobuf-expectation/stubs/strtoint.h \
	google/protobuf-expectation/stubs/template_util.h \
	google/protobuf-expectation/stubs/type_traits.h
nodist_libprotobuf_expectation_la_SOURCES = \
	google/protobuf-expectation/expectation.pb.cc \
	google/protobuf-expectation/expectation.pb.h \
	google/protobuf-expectation/proto-kit.pb.cc \
	google/protobuf-expectation/proto-kit.pb.h
## -version-info tells libtool what to put after the '.so' in the filename.
libprotobuf_expectation_la_LDFLAGS = -version-info @SO_VERSION@

# Rules to build the proto kit generator binary as a protoc plugin.

bin_PROGRAMS = proto-kit-generator-plugin

noinst_LTLIBRARIES = libproto-kit-generator.la

libproto_kit_generator_la_SOURCES = \
	google/protobuf-expectation/descriptor-proto-printer.cc \
	google/protobuf-expectation/descriptor-proto-printer.h \
	google/protobuf-expectation/proto-kit-generator.cc \
	google/protobuf-expectation/proto-kit-generator.h \
	google/protobuf-expectation/stubs/ascii_ctype.cc \
	google/protobuf-expectation/stubs/ascii_ctype.h \
	google/protobuf-expectation/stubs/casts.h \
	google/protobuf-expectation/stubs/integral_types.h \
	google/protobuf-expectation/stubs/join.cc \
	google/protobuf-expectation/stubs/join.h \
	google/protobuf-expectation/stubs/macros.h \
	google/protobuf-expectation/stubs/numbers.cc \
	google/protobuf-expectation/stubs/numbers.h \
	google/protobuf-expectation/stubs/port.h \
	google/protobuf-expectation/stubs/port_hash.h \
	google/protobuf-expectation/stubs/scoped_ptr.h \
	google/protobuf-expectation/stubs/stl_decl.h \
	google/protobuf-expectation/stubs/stl_util.h \
	google/protobuf-expectation/stubs/stringpiece.cc \
	google/protobuf-expectation/stubs/stringpiece.h \
	google/protobuf-expectation/stubs/strtoint.cc \
	google/protobuf-expectation/stubs/strtoint.h \
	google/protobuf-expectation/stubs/template_util.h \
	google/protobuf-expectation/stubs/type_traits.h
libproto_kit_generator_la_CXXFLAGS = $(GFLAGS_CFLAGS)

proto_kit_generator_plugin_SOURCES = \
	google/protobuf-expectation/proto-kit-generator-main.cc
proto_kit_generator_plugin_LDADD = libproto-kit-generator.la -lprotoc \
	$(GFLAGS_LIBS)

# Rules to build tests of the protobuf expectation library.

TESTS += expectation-eval_test proto-kit-converter_test
check_PROGRAMS = expectation-eval_test proto-kit-converter_test

expectation_eval_test_SOURCES = \
	google/protobuf-expectation/expectation-eval_test.cc
nodist_expectation_eval_test_SOURCES = \
	google/protobuf-expectation/unittest.pb.cc \
	google/protobuf-expectation/unittest.pb.h \
	google/protobuf-expectation/unittest-kit.pb.cc \
	google/protobuf-expectation/unittest-kit.pb.h
expectation_eval_test_CXXFLAGS = -I$(top_srcdir)/gtest/include
expectation_eval_test_LDADD = libprotobuf-expectation.la -lre2 \
	$(top_builddir)/gtest/lib/libgtest.la \
	$(top_builddir)/gtest/lib/libgtest_main.la

proto_kit_converter_test_SOURCES = \
	google/protobuf-expectation/proto-kit-converter_test.cc
nodist_proto_kit_converter_test_SOURCES = \
	google/protobuf-expectation/unittest.pb.cc \
	google/protobuf-expectation/unittest.pb.h \
	google/protobuf-expectation/unittest-kit.pb.cc \
	google/protobuf-expectation/unittest-kit.pb.h
proto_kit_converter_test_CXXFLAGS = -I$(top_srcdir)/gtest/include
proto_kit_converter_test_LDADD = libprotobuf-expectation.la -lre2 \
	$(top_builddir)/gtest/lib/libgtest.la \
	$(top_builddir)/gtest/lib/libgtest_main.la

# Rules to build tests of the proto kit generator.

TESTS += descriptor-proto-printer_test proto-kit-generator_test
check_PROGRAMS += descriptor-proto-printer_test proto-kit-generator_test

descriptor_proto_printer_test_SOURCES = \
	google/protobuf-expectation/descriptor-proto-printer_test.cc
descriptor_proto_printer_test_CXXFLAGS = -I$(top_srcdir)/gtest/include
descriptor_proto_printer_test_LDADD = libproto-kit-generator.la \
	$(top_builddir)/gtest/lib/libgtest.la \
	$(top_builddir)/gtest/lib/libgtest_main.la

proto_kit_generator_test_SOURCES = \
	google/protobuf-expectation/proto-kit-generator_test.cc
nodist_proto_kit_generator_test_SOURCES = \
	google/protobuf-expectation/proto-kit-generator_test.pb.cc \
	google/protobuf-expectation/proto-kit-generator_test.pb.h
proto_kit_generator_test_CXXFLAGS = $(GFLAGS_CFLAGS) \
	-I$(top_srcdir)/gtest/include
proto_kit_generator_test_LDADD = libproto-kit-generator.la -lprotoc \
	$(GFLAGS_LIBS) \
	$(top_builddir)/gtest/lib/libgtest.la \
	$(top_builddir)/gtest/lib/libgtest_main.la

# Rules to build a test of generated proto kit.

TESTS += generated-proto-kit_test
check_PROGRAMS += generated-proto-kit_test

gen_protokit_inputs = \
	google/protobuf-expectation/proto-kit-generator_test.proto

gen_protokit_outputs = \
	google/protobuf-expectation/proto-kit-generator_test-kit.proto

gen_protokit_middleman: $(protoc_inputs) proto-kit-generator-plugin
	$(PROTOC) --proto_path=$(srcdir) --protokit_out=$(srcdir) \
	    --plugin=protoc-gen-protokit=proto-kit-generator-plugin \
	    $(gen_protokit_inputs)
	touch gen_protokit_middleman

$(gen_protokit_outputs): gen_protokit_middleman

protoc_protokit_inputs = \
	google/protobuf-expectation/proto-kit-generator_test-kit.proto

protoc_protokit_outputs = \
	google/protobuf-expectation/proto-kit-generator_test-kit.pb.cc \
	google/protobuf-expectation/proto-kit-generator_test-kit.pb.h

protoc_protokit_middleman: $(protoc_protokit_inputs)
	$(PROTOC) --proto_path=$(srcdir) --cpp_out=$(srcdir) \
	    $(protoc_protokit_inputs)
	touch protoc_protokit_middleman

$(protoc_protokit_outputs): protoc_protokit_middleman

generated_proto_kit_test_SOURCES = \
	google/protobuf-expectation/generated-proto-kit_test.cc
nodist_generated_proto_kit_test_SOURCES = \
	google/protobuf-expectation/proto-kit-generator_test.pb.cc \
	google/protobuf-expectation/proto-kit-generator_test.pb.h \
	google/protobuf-expectation/proto-kit-generator_test-kit.pb.cc \
	google/protobuf-expectation/proto-kit-generator_test-kit.pb.h
generated_proto_kit_test-generated-proto-kit_test.$(OBJEXT): $(nodist_generated_proto_kit_test_SOURCES)
generated_proto_kit_test_CXXFLAGS = -I$(top_srcdir)/gtest/include
generated_proto_kit_test_LDADD = libprotobuf-expectation.la -lre2 \
	$(top_builddir)/gtest/lib/libgtest.la \
	$(top_builddir)/gtest/lib/libgtest_main.la

CLEANFILES = $(protoc_outputs) protoc_middleman \
	$(gen_protokit_outputs) gen_protokit_middleman \
	$(protoc_protokit_outputs) protoc_protokit_middleman

## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
